package day06;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.util.Arrays;

public class P02ExceptionHandle {
    public static void main(String[] args) {
        try {
            FileInputStream fis = new FileInputStream(new File("a.txt"));
        } catch (FileNotFoundException e) {

        }
        int[] a = {1, 2, 3};
        try {
            System.out.println(a[3]);
        } catch (ArrayIndexOutOfBoundsException e) {
            int[] a2 = new int[a.length * 2];
            System.arraycopy(a, 0, a2, 0, a.length);
            a = a2;
            System.gc();
            System.out.println(a[3]);
        }
        System.out.println(Arrays.toString(a));
    }

    void f() {
        try {

        } catch (Exception e) {

        }

    }

    void g() {
        f();
    }
}
